import ast

def count_keyword_in_code(code, keyword):
    tree = ast.parse(code)
    counter = 0
    for node in ast.walk(tree):
        if isinstance(node, ast.Str) and keyword in node.s:  # 判断节点是否为字符串并查找关键词
            counter += 1
    return counter

# 示例代码片段
snippet = "for i in range(10): some code; print('another line')"

keyword_count = count_keyword_in_code(snippet, "some code")
print(f"The keyword '{keyword}' appears {keyword_count} times in the given code.")